<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/hexo_blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/hexo_blog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/hexo_blog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/hexo_blog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/hexo_blog/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.2/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.css">
  <script src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.js"></script>

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"bone-nails.gitee.io","root":"/hexo_blog/","images":"/hexo_blog/images","scheme":"Gemini","version":"8.2.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/hexo_blog/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":true,"preload":true}};
  </script>
<meta name="description" content="本文章将介绍hexo环境搭建以及如何初始化一篇博客。基于B站视频，感谢UP主Neko提供的教程！">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo学习(一)">
<meta property="og:url" content="https://bone-nails.gitee.io/2021/04/01/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/index.html">
<meta property="og:site_name" content="Carson Zhao">
<meta property="og:description" content="本文章将介绍hexo环境搭建以及如何初始化一篇博客。基于B站视频，感谢UP主Neko提供的教程！">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/nodejs.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/git.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/git2.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo1.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo2.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo3.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo4.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo5.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo6.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/blog1.png">
<meta property="og:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/blog2.png">
<meta property="article:published_time" content="2021-04-01T04:23:20.000Z">
<meta property="article:modified_time" content="2021-04-01T04:20:52.272Z">
<meta property="article:author" content="Carson Zhao">
<meta property="article:tag" content="hexo">
<meta property="article:tag" content="node.js">
<meta property="article:tag" content="git">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/nodejs.png">


<link rel="canonical" href="https://bone-nails.gitee.io/2021/04/01/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>
<title>hexo学习(一) | Carson Zhao</title>
  




  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

<link rel="alternate" href="/hexo_blog/atom.xml" title="Carson Zhao" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/hexo_blog/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">Carson Zhao</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/hexo_blog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-about"><a href="/hexo_blog/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li>
        <li class="menu-item menu-item-tags"><a href="/hexo_blog/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
        <li class="menu-item menu-item-categories"><a href="/hexo_blog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%9C%AC%E6%96%87%E7%AB%A0%E5%B0%86%E4%BB%8B%E7%BB%8Dhexo%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA%E4%BB%A5%E5%8F%8A%E5%A6%82%E4%BD%95%E5%88%9D%E5%A7%8B%E5%8C%96%E4%B8%80%E7%AF%87%E5%8D%9A%E5%AE%A2%E3%80%82"><span class="nav-number">1.</span> <span class="nav-text">本文章将介绍hexo环境搭建以及如何初始化一篇博客。</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9F%BA%E4%BA%8EB%E7%AB%99%E8%A7%86%E9%A2%91%EF%BC%8C%E6%84%9F%E8%B0%A2UP%E4%B8%BBNeko%E6%8F%90%E4%BE%9B%E7%9A%84%E6%95%99%E7%A8%8B%EF%BC%81"><span class="nav-number">2.</span> <span class="nav-text">基于B站视频，感谢UP主Neko提供的教程！</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%80%E4%B9%88%E6%98%AFHexo"><span class="nav-number">2.1.</span> <span class="nav-text">什么是Hexo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85Node-js"><span class="nav-number">2.2.</span> <span class="nav-text">安装Node.js</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85Git"><span class="nav-number">2.3.</span> <span class="nav-text">安装Git</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85hexo"><span class="nav-number">2.4.</span> <span class="nav-text">安装hexo</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%BD%91%E4%B8%8A%E5%BE%88%E5%A4%9A%E6%95%99%E7%A8%8B%E6%8F%90%E5%88%B0%E9%9C%80%E8%A6%81%E5%AE%89%E8%A3%85cnpm%E6%8F%90%E9%AB%98%E9%80%9F%E5%BA%A6%EF%BC%8C%E6%88%91%E7%9A%84%E7%94%B5%E8%84%91%E8%AF%95%E4%BA%86%E4%B8%80%E4%B8%8B%E7%94%A8cnpm%E4%B8%8B%E8%BD%BD%E4%BC%9A%E6%8A%A5%E9%94%99%EF%BC%8C%E6%89%80%E4%BB%A5%E6%88%91%E4%BB%AC%E8%B7%B3%E8%BF%87%E8%BF%99%E4%B8%80%E6%AD%A5%EF%BC%8C%E4%B8%8D%E4%BD%BF%E7%94%A8%E6%B7%98%E5%AE%9D%E9%95%9C%E5%83%8F%EF%BC%8C%E7%9B%B4%E6%8E%A5%E7%94%A8npm%E4%B8%8B%E8%BD%BDhexo%E3%80%82"><span class="nav-number">2.4.1.</span> <span class="nav-text">网上很多教程提到需要安装cnpm提高速度，我的电脑试了一下用cnpm下载会报错，所以我们跳过这一步，不使用淘宝镜像，直接用npm下载hexo。</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%BB%88%E7%AB%AF%E8%BE%93%E5%85%A5%EF%BC%9Anpm-install-%E7%94%A8%E6%9D%A5%E8%BF%98%E5%8E%9F%E6%A8%A1%E5%9D%97"><span class="nav-number">2.4.2.</span> <span class="nav-text">终端输入：npm install 用来还原模块</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%BF%90%E8%A1%8C%E6%B5%8B%E8%AF%95"><span class="nav-number">2.5.</span> <span class="nav-text">运行测试</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%9D%E5%A7%8B%E5%8C%96%E5%8D%9A%E5%AE%A2"><span class="nav-number">2.6.</span> <span class="nav-text">初始化博客</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Carson Zhao"
      src="/hexo_blog/images/1.png">
  <p class="site-author-name" itemprop="name">Carson Zhao</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/hexo_blog/archives">
          <span class="site-state-item-count">59</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/hexo_blog/categories/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/hexo_blog/tags/">
          
        <span class="site-state-item-count">35</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="cc-license site-overview-item animated" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="/hexo_blog/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://bone-nails.gitee.io/2021/04/01/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo_blog/images/1.png">
      <meta itemprop="name" content="Carson Zhao">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Carson Zhao">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          hexo学习(一)
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>
      

      <time title="创建时间：2021-04-01 12:23:20 / 修改时间：12:20:52" itemprop="dateCreated datePublished" datetime="2021-04-01T12:23:20+08:00">2021-04-01</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/hexo_blog/categories/Hexo%E5%8D%9A%E5%AE%A2/" itemprop="url" rel="index"><span itemprop="name">Hexo博客</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>1k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>1 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="本文章将介绍hexo环境搭建以及如何初始化一篇博客。"><a href="#本文章将介绍hexo环境搭建以及如何初始化一篇博客。" class="headerlink" title="本文章将介绍hexo环境搭建以及如何初始化一篇博客。"></a>本文章将介绍hexo环境搭建以及如何初始化一篇博客。</h1><h1 id="基于B站视频，感谢UP主Neko提供的教程！"><a href="#基于B站视频，感谢UP主Neko提供的教程！" class="headerlink" title="基于B站视频，感谢UP主Neko提供的教程！"></a><a target="_blank" rel="noopener" href="https://www.bilibili.com/video/av23913382?t=51">基于B站视频</a>，感谢UP主Neko提供的教程！</h1><span id="more"></span>
<h2 id="什么是Hexo"><a href="#什么是Hexo" class="headerlink" title="什么是Hexo"></a>什么是Hexo</h2><blockquote>
<p>Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。<br>最重要的一点：通过hexo搭建的博客可以部署到github上，从而省去了购买服务器的开销。hexo官方网址：<a target="_blank" rel="noopener" href="https://hexo.io/"><code>https://hexo.io</code></a>  </p>
</blockquote>
<h2 id="安装Node-js"><a href="#安装Node-js" class="headerlink" title="安装Node.js"></a>安装Node.js</h2><blockquote>
<p>Hexo需用通过npm安装，而npm需要node，现在只要安装node 就自带 npm了</p>
</blockquote>
<p>进入<a target="_blank" rel="noopener" href="https://nodejs.org/en/">官方网站</a>,选择箭头所指的长期且稳定的版本进行下载。<br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/nodejs.png" alt="nodejs"><br>安装目录最好不要选择C盘，安装过程一直next就行。</p>
<h2 id="安装Git"><a href="#安装Git" class="headerlink" title="安装Git"></a>安装Git</h2><p>进入<a target="_blank" rel="noopener" href="https://git-scm.com/downloads">官方网站</a>,选择对应版本进行下载。<br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/git.png" alt="Git"><br>安装也是一直下一步，安装路径最好不要选择C盘。<br>在开始菜单可以找到git相关组件。<br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/git2.png" alt="Git">  </p>
<blockquote>
<p>tips:之后我们都用Git Bash来打开终端进行操作。  </p>
</blockquote>
<h2 id="安装hexo"><a href="#安装hexo" class="headerlink" title="安装hexo"></a>安装hexo</h2><p>在桌面新建一个MyBlog文件夹<br>进入文件夹，空白处点击鼠标右键，点击Git Bash进入终端。<br>先检查node和npm是否安装成功，如下图：<br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo1.png" alt="hexo">  </p>
<h3 id="网上很多教程提到需要安装cnpm提高速度，我的电脑试了一下用cnpm下载会报错，所以我们跳过这一步，不使用淘宝镜像，直接用npm下载hexo。"><a href="#网上很多教程提到需要安装cnpm提高速度，我的电脑试了一下用cnpm下载会报错，所以我们跳过这一步，不使用淘宝镜像，直接用npm下载hexo。" class="headerlink" title="网上很多教程提到需要安装cnpm提高速度，我的电脑试了一下用cnpm下载会报错，所以我们跳过这一步，不使用淘宝镜像，直接用npm下载hexo。"></a>网上很多教程提到需要安装cnpm提高速度，我的电脑试了一下用cnpm下载会报错，所以我们跳过这一步，不使用淘宝镜像，直接用npm下载hexo。</h3><p>在终端中输入<code>npm install -g hexo-cli</code><br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo2.png" alt="hexo"><br>再输入<code>hexo -v</code>检验是否安装成功。<br>最后我们建立整个项目<br>终端中输入<code>hexo init</code><br>结果如下：<img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo3.png" alt="hexo"><br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo4.png" alt="hexo"><br>可以看到在MyBlog中生成了很多文件，其中source文件夹将用来存放博客文件，_config.iml将用来进行相关配置。</p>
<h3 id="终端输入：npm-install-用来还原模块"><a href="#终端输入：npm-install-用来还原模块" class="headerlink" title="终端输入：npm install 用来还原模块"></a>终端输入：<code>npm install</code> 用来还原模块</h3><h2 id="运行测试"><a href="#运行测试" class="headerlink" title="运行测试"></a>运行测试</h2><p>hexo经常用到的四个命令：  </p>
<pre><code>1. hexo clean #用来清理缓存文件
2. hexo g      #生成静态网站，会生成一个public文件夹
3. hexo  s     #运行本地服务器
4. hexo  d   #上传到服务器  
</code></pre>
<p>最后一步，我们在终端中输入<code>hexo s</code>，结果如下：<br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo5.png" alt="hexo"><br>打开浏览器，输入<code>localhost:4000</code>，hexo的初步搭建就已经完成了。<br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/hexo6.png" alt="hexo">  </p>
<blockquote>
<p>tips:切记不要在终端中选中<code>localhost:4000</code>再按ctrl+v，不然会停止。</p>
</blockquote>
<h2 id="初始化博客"><a href="#初始化博客" class="headerlink" title="初始化博客"></a>初始化博客</h2><p>在终端中输入<code>hexo n &quot;hexo学习(一)&quot;</code>，即可自定义一篇自己的博客。<br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/blog1.png" alt="blog"><br><img src="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/Hexo/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/blog2.png" alt="blog"><br>可以看到在source_posts目录下生成了对应的.md文件，使用markdown即可编写自己的博客，同理最后在终端输入<code>hexo s</code>即可在<code>localhost：4000</code>看到自己的博客。</p>

    </div>

    
    
    

    <footer class="post-footer">
          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>Carson Zhao
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="https://bone-nails.gitee.io/2021/04/01/hexo%E5%AD%A6%E4%B9%A0-%E4%B8%80/" title="hexo学习(一)">https://bone-nails.gitee.io/2021/04/01/hexo学习-一/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/hexo_blog/tags/hexo/" rel="tag"># hexo</a>
              <a href="/hexo_blog/tags/node-js/" rel="tag"># node.js</a>
              <a href="/hexo_blog/tags/git/" rel="tag"># git</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/hexo_blog/2021/04/01/markdown%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95/" rel="prev" title="markdown基本语法">
                  <i class="fa fa-chevron-left"></i> markdown基本语法
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/hexo_blog/2021/04/01/hexo%E5%AD%A6%E4%B9%A0-%E4%BA%8C/" rel="next" title="hexo学习(二)">
                  hexo学习(二) <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>







<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Carson Zhao</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">125k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">1:54</span>
  </span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script size="300" alpha="0.6" zIndex="-1" src="https://cdn.jsdelivr.net/npm/ribbon.js@1.0.2/dist/ribbon.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
<script src="/hexo_blog/js/utils.js"></script><script src="/hexo_blog/js/next-boot.js"></script>

  
<script src="/hexo_blog/js/local-search.js"></script>



<script>
if (document.querySelectorAll('.pdf-container').length) {
  NexT.utils.getScript('https://cdn.jsdelivr.net/npm/pdfobject@2.2.4/pdfobject.min.js', () => {
    document.querySelectorAll('.pdf-container').forEach(element => {
      PDFObject.embed(element.dataset.target, element, {
        pdfOpenParams: {
          navpanes : 0,
          toolbar  : 0,
          statusbar: 0,
          pagemode : 'thumbs',
          view     : 'FitH'
        },
        PDFJS_URL: '/hexo_blog/lib/pdf/web/viewer.html',
        height   : element.dataset.height
      });
    });
  }, window.PDFObject);
}
</script>


  <script>
    NProgress.configure({
      showSpinner: true
    });
    NProgress.start();
    document.addEventListener('readystatechange', () => {
      if (document.readyState === 'interactive') {
        NProgress.inc(0.8);
      }
      if (document.readyState === 'complete') {
        NProgress.done();
      }
    });
    document.addEventListener('pjax:send', () => {
      NProgress.start();
    });
    document.addEventListener('pjax:success', () => {
      NProgress.done();
    });
  </script>

  
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>





<script src="/hexo_blog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginModelPath":"assets/","model":{"jsonPath":"/hexo_blog/live2dw/assets/hijiki.model.json"},"display":{"position":"right","width":200,"height":400},"mobile":{"show":true},"log":false,"pluginJsPath":"lib/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
